package bean;

public class MagneticKnnNode implements Comparable<MagneticKnnNode> {
    private int id;
    private double dist;
    private MagneticNode node;

    public MagneticKnnNode() {
        super();
    }

    public MagneticKnnNode(int id, double dist, MagneticNode node) {
        super();
        this.id = id;
        this.dist = dist;
        this.node = node;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getDist() {
        return dist;
    }

    public void setDist(double dist) {
        this.dist = dist;
    }

    public MagneticNode getNode() {
        return node;
    }

    public void setNode(MagneticNode node) {
        this.node = node;
    }


    @Override
    public int compareTo(MagneticKnnNode o) {
        double sub = this.getDist() - o.getDist();
        if (sub == 0) {
            return 0;
        } else if (sub < 0) {
            return -1;
        } else {
            return 1;
        }
    }
}
